package com.agent.action.config;

import com.agent.action.client.DifyAgentClient;
import com.agent.action.client.DifyWorkClient;
import com.agent.action.entity.AgentChatEntity;
import com.agent.action.entity.GenerateMarkDownEntity;
import com.agent.action.entity.QuestionEntity;
import com.agent.action.entity.TestEntity;
import com.agent.action.interfaces.WorkFlowClient;
import com.agent.action.param.ChatParam;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 注入dify客户段
 */
@Configuration
public class DifyConfig {
    /**
     * dify的请求uri
     */
    @Value("${dify.uri}")
    private String uri;
    @Value("${dify.api-one}")
    private String keyOne;
    @Value("${dify.api-two}")
    private String keyTwo;
    @Value("${dify.api-three}")
    private String keyThree;
    @Value("${dify.agentApi}")
    private String agentKey;


    /**
     * 注入dify客户段---题目生成工作流
     * @return
     */
    @Bean
    public WorkFlowClient<QuestionEntity> difyWorkClient(){
        return new DifyWorkClient<QuestionEntity>()
                .key(keyOne).url("/workflows").builder(uri);
    }

    /**
     * 注入dify客户端---练习生成工作流
     * @return
     */
    @Bean
    public WorkFlowClient<TestEntity> difyTestClient(){
        return new DifyWorkClient<TestEntity>()
                .key(keyTwo).url("/workflows").builder(uri);
    }

    /**
     * 注入dify客户端---生成文件的MarkDown形式
     */
    @Bean
    public WorkFlowClient<GenerateMarkDownEntity> difyMarkDownClient(){
        return new DifyWorkClient<GenerateMarkDownEntity>()
                .key(keyThree).url("/workflows").builder(uri);
    }

    /**
     * 注入dify客户端---对话智能体
     * @return
     */
    @Bean
    public DifyAgentClient<AgentChatEntity> difyAgentClient(){
        return new DifyAgentClient<AgentChatEntity>()
                .key(agentKey).builder(uri);
    }
}
